Content alignment method and system

ABSTRACT

A method is provided for content alignment. The method includes obtaining a first content sequence and a second content sequence different from the first content sequence. The method also includes representing each of the first content sequence and the second content sequence in a hierarchical structure containing an ordered root element sequence and a sub-tree structure. The ordered root element sequence includes a plurality of root elements and each root element is associated with a sub-tree of elements. The method also includes determining a desired alignment between the first content sequence and the second content sequence using dynamic programming, and outputting results of the desired alignment between the first content sequence and the second content sequence.

FIELD OF THE INVENTION

The present invention generally relates to digital content processing technologies and, more particularly, to methods and systems for content matching, alignment, and presentation.

BACKGROUND

Information in most media applications is organized in hierarchical structures, for example, typical online book stores have shopping categories of book->science-fiction/non-fiction, while scientific papers and movie subtitles are organized in a structure of paragraph, sentence, word and characters; video data is described as scenes, shots, frames, blocks and pixels.

However, these hierarchical structures are not unified or standardized. FIG. 1A shows a goods taxonomy of Amazon, and FIG. 1B shows a goods taxonomy of Yahoo! Shopping. As shown in FIG. 1A and FIG. 1B, the “Magazines” is a second-level category in Amazon while a first-level item in Yahoo!. Further, some item in the one structure (e.g., “Kindle books”) does not exist in the other. The structural differences may become challenging for applications that need to access items of both taxonomies.

The disclosed method and apparatus are directed to solve one or more problems set forth above and other problems.

BRIEF SUMMARY OF THE DISCLOSURE

One aspect of the present disclosure includes a method for content alignment. The method includes obtaining a first content sequence and a second content sequence different from the first content sequence. The method also includes representing each of the first content sequence and the second content sequence in a hierarchical structure containing an ordered root element sequence and a sub-tree structure. The ordered root element sequence includes a plurality of root elements and each root element is associated with a sub-tree of elements. The method also includes determining a desired alignment between the first content sequence and the second content sequence using dynamic programming, and outputting results of the desired alignment between the first content sequence and the second content sequence.

Another aspect of the present disclosure includes a content alignment system. The content alignment system includes a memory module, an output interface, and a processor. The processor is coupled to the memory module and the output interface and is configured to obtain a first content sequence and a second content sequence different from the first content sequence and to represent each of the first content sequence and the second content sequence in a hierarchical structure containing an ordered root element sequence and a sub-tree structure. The ordered root element sequence includes a plurality of root elements and each root element is associated with a sub-tree of elements. The processor is further configured to determine a desired alignment between the first content sequence and the second content sequence using dynamic programming, and to output results of the desired alignment between the first content sequence and the second content sequence through the output interface.

Other aspects of the present disclosure can be understood by those skilled in the art in light of the description, the claims, and the drawings of the present disclosure.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A shows an existing goods taxonomy;

FIG. 1B shows another existing goods taxonomy;

FIG. 2 illustrates an exemplary environment incorporating certain embodiments of the present invention;

FIG. 3 illustrates an exemplary computing system consistent with the disclosed embodiments;

FIG. 4 illustrates a flow chart of an exemplary content alignment process consistent with the disclosed embodiments;

FIG. 5 illustrates an exemplary representation of a content sequence consistent with the disclosed embodiments;

FIG. 6 illustrates two exemplary content sequences to be aligned consistent with the disclosed embodiments;

FIG. 7 illustrates an exemplary alignment of certain elements consistent with the disclosed embodiments;

FIG. 8 illustrates another exemplary alignment of certain elements consistent with the disclosed embodiments; and

FIG. 9 illustrates exemplary distance determination consistent with the disclosed embodiments.

DETAILED DESCRIPTION

Reference will now be made in detail to exemplary embodiments of the invention, which are illustrated in the accompanying drawings. Wherever possible, the same reference numbers will be used throughout the drawings to refer to the same or like parts.

FIG. 2 illustrates an exemplary environment 200 incorporating certain embodiments of the present invention. As shown in FIG. 2, environment 200 includes a terminal 202, a server 206, a network 210, and a user 208. Other components may also be included.

Terminal 202 may include any appropriate type of user terminal or any type of computing equipment. For terminal 202 may include a TV, such as plasma TV, LCD TV, projection TV, non-smart TV, or smart TV, a personal computer (PC), a tablet or mobile computer, or a smart phone, etc. Although only one terminal 202 is included, any number of terminals may be included.

Server 206 may include any appropriate type of server. For example, server 206 may include a web server, a content server, an application server, a database server, etc. Although only one server 206 is shown, any number of servers may be included.

Further, the network 210 may include any appropriate type of computer or communication network, such as the Internet. Also, the network 210 may also include a cloud computing environment. Terminal 202 and server 206 may communicate with each other through the network 210.

Terminal 202 and/or server 206 may be implemented on any appropriate computing circuitry platform. FIG. 3 shows a block diagram of an exemplary computing system 200 capable of implementing terminal 202 and/or server 206.

As shown in FIG. 3, computing system 300 may include a processor 302, a storage medium 304, a monitor 306, a communication module 308, a database 310, and peripherals 312. Certain devices may be omitted and other devices may be included.

Processor 302 may include any appropriate processor or processors. Further, processor 302 can include multiple cores for multi-thread or parallel processing. Storage medium 304 may include memory modules, such as ROM, RAM, flash memory modules, and mass storages, such as CD-ROM and hard disk, etc. Storage medium 304 may store computer programs for implementing various processes, when the computer programs are executed by processor 302.

Further, peripherals 312 may include various sensors and other I/O devices, such as keyboard and mouse, and communication module 308 may include certain network interface devices for establishing connections through communication networks. Database 310 may include one or more databases for storing certain data and for performing certain operations on the stored data, such as database searching.

In operation, terminal 202 and/or server 206 may implement a content analyzing process for searching, comparing, and aligning content sequences inputted into the terminal 202 and/or server 206. FIG. 4 illustrates a flow chart of an exemplary content alignment process by computing system 300 consistent with the disclosed embodiments. The content matching process may be implemented on terminal 202, server 206, or both terminal 202 and server 206.

As shown in FIG. 4, at the beginning, a first content sequence and a second content sequence are obtained (402). The content sequences may include any appropriate contents. For example, the first content sequence and the second content sequence may be web contents, or the first content sequence and the second content sequence may be video sequences. Any content with sequential structure may be used.

Further, computing system 300 (e.g., processor 302) may obtain the first content sequence and the second content sequence from input devices, from storage devices, or from the network communication interface. After obtaining the first content sequence and the second content sequence (402), the processor 302 may represent each the first content sequence and the second content sequence in a hierarchical structure (404).

For example, as shown in FIG. 5, a content sequence (e.g., first content sequence, second content sequence) is represented in a hierarchical structure. Each of the first content sequence and the second content sequence may include a root element sequence and a sub-tree structure. That is, the hierarchical structure includes a root element sequence containing one or more element, and each root element may have a sub-tree structure. The hierarchical structure may then be divided into different levels, with the root element at the highest level, and the level decreases sequentially along the level of the sub-tree structure.

That is, the hierarchical structure may include any levels, and each level may be one or more sequences of elements. For example, a K-level hierarchical structure Z (e.g., S1 or S2) may be composed of an ordered sequence (the sequence can be only one component) of successive K-level tree structures. As shown in FIG. 4, Z can be treated as a composition of an ordered sequence of root elements on the K^(th) level (denoted as r(Z)) plus an ordered sequence of remaining (K−1)-level sub-tree structures (denoted as sub (Z)) belonging to these roots, i.e.,

Z=r(Z)+sub(Z)  (1)

An ordered sequence of sub-tree structures can also be viewed as a complete hierarchical structure which is composed of a set of root elements, which represents the characteristics of the structures on this level, and sub-tree structures inside these structures. In other words, the set of root elements can be represented by a feature vector according to the type of class they belong to and roles they played on the same level.

For instance, a movie subtitle can be simplified as a three-level structure of “paragraph-sentence-word”. On the paragraph level, features may include the type of paragraphs such as narration, exposition, definition, description, comparison, process analysis and persuasion, as well as roles they played in the subtitle such as head, body and conclusion. The features on the sentence level include sentence types such as statement, question, command and exclamation, as well as their roles such as topic sentence, supportive sentence, concluding sentence and example. Further, the word level features include part of speech such as noun, verb, adjective, adverb and so on, as well as their roles played in sentence such as subject, predicate, object and so on.

FIG. 6 illustrates two exemplary hierarchical subtitles S and T. For illustrative purposes, S and T are extracts of two subtitle versions of the movie “The Matrix”. As shown in FIG. 6, subtitle sequence S is represented as a hierarchical structure having two root elements s₁,s₂, and a 2-level sub-tree structure. The subtitle sequence T is also represented as a hierarchical structure having two root elements t₁,t₂, and a 2-level sub-tree structure.

The root elements r(S) represents the characteristics of s₁s₂ on the level of paragraph, while the sub-tree structures sub (S) are all the sentences in these two paragraphs, as well as all the words belonging to these sentences. The root elements r(T) represents the characteristics of t₁t₂ on the level of paragraph, while the sub-tree structures sub (T) are all the sentences in these two paragraphs, as well as all the words belonging to these sentences.

More specifically, the 3^(rd) level element s₁ represents the first paragraph in the subtitle S, and the 3^(rd) level element s₂ represents the second paragraph in the subtitle S. The 2^(nd) level element s₁₁: “You could say that” represents the 1^(st) sentence in paragraph s₁, and 2^(nd) level element s₁₂: “I can see it in your eyes” represents the 2^(nd) sentence in paragraph s₁.

The 2^(nd) level element s₂₁: “You have the look of a man who accepts” represents the 1^(st) sentence in paragraph s₂, and 2^(nd) level element

s₂₂: “What he sees because he's expecting to wake up” represents the 2^(nd) sentence in paragraph s₂.

The 1^(st) level element s₁₁₁: “You” represents the 1^(st) word in sentence s₁₁, and 1^(st) level element s₁₁₄: “that” represents the last word in sentence s₁₁. The 1^(st) level element s₁₂₁: “I” represents the 1^(st) word in sentence s₁₂, and 1^(st) level element s₁₂₇: “eyes” represents the last word in sentence s₁₂. The 1^(st) level element s₂₁₁: “You” represents the 1^(st) word in sentence s₂₁, and 1^(st) level element s₂₁₉: “accepts” represents the last word in sentence s₂₁. The 1^(st) level element s₂₂₁: “what” represents the 1^(st) word in sentence s₂₂, and 1^(st) level element s₂₂₉: “up” represents the last word in sentence s₂₂.

Similarly, the 3^(rd) level element t₁ represents the first paragraph in the subtitle T, and the 3^(rd) level element t₂ represents the second paragraph in the subtitle T. The 2^(nd) level element t₁₁: “You could say this” represents the 1^(st) sentence in paragraph t₁.

The 2^(nd) level element t₂₁: “I am sure” represents the 1^(st) sentence in paragraph t₂, the 2^(nd) level element t₂₂: “You look like a man” represents the 2^(nd) sentence in paragraph t₂, the 2^(nd) level element t₂₃: “He accepts what he sees” represents the 3^(rd) sentence in paragraph t₂, and the 2^(nd) level element t₂₄: “since he wants to wake up” represents the 4^(th) sentence in paragraph t₂.

The 1^(st) level element t₁₁₁: “You” represents the 1^(st) word in sentence t₁₁, and 1^(st) level element t₁₁₄: “this” represents the last word in sentence t₁₁. The 1^(st) level element t₂₁₁: “I” represents the 1^(st) word in sentence t₂₁, and 1^(st) level element t₂₁₃: “sure” represents the last word in sentence t₂₁. The 1^(st) level element t₂₂₁: “You” represents the 1^(st) word in sentence t₂₂, and 1^(st) level element t₂₂₅: “man” represents the last word in sentence t₂₂. The 1^(st) level element t₂₃₁: “He” represents the 1^(st) word in sentence t₂₃, and 1^(st) level element t₂₃₅: “sees” represents the last word in sentence t₂₃. The 1^(st) level element t₂₄₁: “since” represents the 1^(st) word in sentence t₂₄, and 1^(st) level element t₂₄₆: “up” represents the last word in sentence t₂₄.

Further, returning to FIG. 4, after representing each the first content sequence and the second content sequence in a hierarchical structure (404), processor 302 may find an alignment between the first content sequence and the second content sequence (406).

To find the alignment between two sequences X and Y, of sizes |X| and |Y|, respectively,

X=x ₁ . . . x _(m) . . . x _(|X|)

Y=y ₁ . . . y _(n) . . . y _(|Y|)

may be treated as constructing an alignment L(X,Y) where each component is an aligned pair. This aligned pair is an element pair (x_m,y_n) when two elements are aligned, or an indel pair (x_m,null) or (null,y_n) when one element is aligned with a null.

For instance, in FIG. 7, X and Y are 2nd-level element sequences in the movie subtitle structure, X=s_(—)11 s_(—)12 s_(—)21 s_(—)22 and Y=t_(—)11 t_(—)21 t_(—)22 t_(—)23 t_(—)24 and one alignment between them is displayed in FIG. 8.

(X,Y)=[(s ₁₁ ,t ₁₁),(s ₁₂,null),(null,t ₂₁),(s ₂₁ ,t ₂₂),(null,t ₂₃),(s ₂₂ ,t ₂₄)]

The total distance of alignment can be represented as the summation of dissimilarities of all aligning pairs in the alignment. Then the total distance of alignment

(X,Y) can be computed as dis(s₁₁,t₁₁)+dis(s₁₂,null)+dis(null,t₂₁)+dis(s₂₁,t₂₂)+dis(null,t₂₃)+dis(s₂₂,t₂₄). Here, dis(s₁₁,t₁₁) denotes the dissimilarity of aligning pair (s₁₁,t₁₁).

Although summation is used in the exemplary sequential alignment to calculate the total distance, other variations of the additive function, for example, weighted summation, multiplication, and so on, may also be used. In addition, certain distance measurement may be needed for obtaining the distance of the indel pair that involves alignment to a null.

An optimal or desired alignment is the one among all feasible alignments that can give the minimal total distance. Further, multiple elements can be aligned at one time when trying to find optimal alignment. In certain embodiments, the concatenation of several elements from one sequence can be best aligned with the element in the other sequence.

For example, in the alignment of X=s₁₁s₁₂s₂₁s₂₂ and Y=t₁₁t₂₁t₂₂t₂₃t₂₄, the result shows that the concatenation of s₂₁ (You have a look of a man who accepts) and s₂₂ (what he sees because he's expecting to wake up) can be best aligned with the concatenation of t₂₂ (You look like a man), t₂₃ (He accepts what he sees) and t₂₄ (since he wants to wake up) as shown in FIG. 7.

Thus, alignment

*(X,Y) including structure pair (s₂₁s₂₂,t₂₂t₂₃t₂₄) outperforms the alignment obtained from the one-to-one element aligning method since it gives less total distance. Therefore, multiple-element aligning may be taken into consideration.

*(X,Y)=[(s ₁₁ ,t ₁₁),(s ₁₂,null),(null,t ₂₁),(s ₂₁ s ₂₂ ,t ₂₂ t ₂₃ t ₂₄)]

Thus, the objective is to find the optimal alignment to achieve minimum distance between any two K-level hierarchical structures S and T.

The alignment

(S,T) between two structures S and T may be defined as aligning the sequence of tree structures in S with the sequence of tree structures in T. Each aligning pair (s,t)ε

(S,T) can be a pair of K-level tree structures or an indel pair where one structure is aligned with a null. The optimal alignment is in the set of all feasible alignments {

(S,T)}.

Let DIS(K,S,T) to denote the distance between two K-level hierarchical structures S and T with the optimal alignment. Then, it is the minimal distance of alignment among all feasible alignments,

$\begin{matrix} {{{DIS}\left( {K,S,T} \right)} = {\min\limits_{\mathcal{L} \in {\{{\mathcal{L}{({S,T})}}\}}}\left( {\sum\limits_{{({s,t})} \in \mathcal{L}}\; {{dis}\left( {K,s,t} \right)}} \right)}} & (2) \end{matrix}$

where dis(K,s,t) denotes the dissimilarity of the K-level aligning pair (s,t).

According to the composition of one hierarchical structure defined in (1), the dissimilarity dis(K,s,t) relies on two factors: the distance between the K^(th)-level root elements r(s) and r(t), denoted as dis_(r) (K,r(s),r(t)), and the distance between two (K−1)-level sub-tree structures sub(s) and sub(t) with the optimal alignment, that is, DIS(K−1,sub(s),sub(t)),

$\begin{matrix} {{{dis}\left( {K,s,t} \right)} = \left\{ \begin{matrix} {{{{dis}_{r}\left( {K,{r(s)},{r(t)}} \right)} \oplus {{DIS}\left( {{K - 1},{{sub}(s)},{{sub}(t)}} \right)}},} & {K > 1} \\ {{{dis}_{r}\left( {K,{r(s)},{r(t)}} \right)},} & {K = 1} \end{matrix} \right.} & (3) \end{matrix}$

Hence, DIS(K,S,T) has the following expression:

$\begin{matrix} {{{DIS}\left( {K,S,T} \right)} = \left\{ \begin{matrix} {{\min\limits_{\mathcal{L} \in {\{{\mathcal{L}{({S,T})}}\}}}\left( {\sum\limits_{{({s,t})} \in \mathcal{L}}\; \begin{bmatrix} {{{dis}_{r}\left( {K,{r(s)},{r(t)}} \right)} \oplus} \\ {{DIS}\left( {{K - 1},{{sub}(s)},{{sub}(t)}} \right)} \end{bmatrix}} \right)},} & {K > 1} \\ {{\min\limits_{\mathcal{L} \in {\{{\mathcal{L}{({S,T})}}\}}}\left( {\sum\limits_{{({s,t})} \in \mathcal{L}}\; \left\lbrack {{dis}_{r}\left( {K,{r(s)},{r(t)}} \right)} \right\rbrack} \right)},} & {K = 1} \end{matrix} \right.} & (4) \end{matrix}$

The interaction ⊕ in (3) and (4) is an abstraction of such type of operations, which can be addition, multiplication, or sum of squares, or others. Exact formation of this interaction may vary depending on the specific applications. For example, if weighted linear additional function is selected, (4) can be rewritten as

$\begin{matrix} {{{DIS}\left( {K,S,T} \right)} = \left\{ \begin{matrix} {{\min\limits_{\mathcal{L} \in {\{{\mathcal{L}{({S,T})}}\}}}\left( {\sum\limits_{{({s,t})} \in \mathcal{L}}\; \begin{bmatrix} {{\alpha*{{dis}_{r}\left( {K,{r(s)},{r(t)}} \right)}} + {\left( {1 - \alpha} \right)*}} \\ {{DIS}\left( {{K - 1},{{sub}(s)},{{sub}(t)}} \right)} \end{bmatrix}} \right)},} & {K > 1} \\ {{\min\limits_{\mathcal{L} \in {\{{\mathcal{L}{({S,T})}}\}}}\left( {\sum\limits_{{({s,t})} \in \mathcal{L}}\; \left\lbrack {{dis}_{r}\left( {K,{r(s)},{r(t)}} \right)} \right\rbrack} \right)},} & {K = 1} \end{matrix} \right.} & (5) \end{matrix}$

where the weights are determined by the application.

If the aligning pair is an indel, e.g., (s,null), the dissimilarity of this indel dis(K,s,null) may be defined as a penalty, dis_(r) (K,r(s),null) and D is (K−1,sub(s),null) will be given two corresponding penalty values.

On the other hand, there may be two types of distance in Eq. (4), the distance of structure and the distance of root elements. The former can be handled by the recursive function in Eq. (4). As mentioned earlier, the root elements are represented by vector of features, depending on the applications, the value of vector can be Boolean or normalized real numbers in [0, 1], thus Euclidean distance can be used as a measurement for the distance between vectors, that is:

dis_(r)(K,r(S),r(T))=∥{right arrow over (V)}(r(s))−{right arrow over (V)}(r(t))∥_(F)  (6)

where {right arrow over (V)}(r(˜)) is the feature vector of a root element.

Table 1 below shows an example of the features where each feature is a Boolean value. As features indicated, the root element s₂₂ is a statement and is supportive, and the root element t₂₁ is a statement and a conclusion. The distance between them equals to ∥<1,0,0,0,0,1,0,0–−<1,0,0,0,0,0,1,0>∥_(F)=√{square root over (2)}.

TABLE 1 Feature vectors for root element s₂₂ and t₂₁ s₂₂ what he sees because he's t₂₁ Features expecting to wake up I am sure Sentence Types statement 1 1 question 0 0 command 0 0 exclamation 0 0 Roles topic 0 0 support 1 0 conclusion 0 1 example 0 0

As shown in Table 1, the feature vectors for different levels of the root elements might be different, thus feature vectors participating in the calculation of Eq. (6) might vary across the levels of the structure.

As shown in Eq. (4), the desired distance can be obtained by finding the alignment solution for the root elements that can minimize the distance in the equation. The property of sequential structure may need to be defined.

According to disclosed embodiments, considering two k-level root elements X and Y, X_(m)=x₁ . . . x_(m) represents the partial sequence consisting of the first m elements in X, and X_(|X|\m)=X−X_(m)=x_(m+1) . . . x_(|X|) is the remaining part of X. Likewise we have Y_(n)=y₁ . . . y_(n),Y_(|Y|\n)=y_(n+)1 . . . y_(|Y|), then

$\begin{matrix} {{{DIS}\left( {k,X_{m},Y_{n}} \right)} = {\min\limits_{{({i,j})} \in {\lbrack{{({0,0})},{({m,n})}})}}\left\{ {{{DIS}\left( {k,X_{i},Y_{j}} \right)} + {{dis}\left( {k,X_{m\backslash i},Y_{n\backslash j}} \right)}} \right\}}} & (7) \end{matrix}$

This is the case because it can be found that the last aligning pair in the total alignment

(X_(m),Y_(n)) can only belong to one of the following cases:

-   -   1) x_(m) aligned with y_(n): (x_(m),y_(n))     -   2) x_(m) aligned with a null: (x_(m),null)     -   3) y_(n) aligned with a null: (null,y_(n))     -   4) x_(m) aligned with any partial sequence in Y including y_(n):         (x_(m),y_(j) . . . y_(n)), 1≦j<n     -   5) Any partial sequence in X including x_(m) aligned with y_(n):         (x_(i) . . . x_(m),y_(n)), 1≦i<m     -   6) Any partial sequence in X including x_(m) aligned with any         partial sequence in Y including y_(n): (x_(i) . . . x_(m),y_(i)         . . . y_(n)), 1≦i<m, 1≦j<n

The distance DIS(k,X_(m),Y_(n)) comes from the dissimilarity of the last aligning pair plus the best alignment distance for the preceding partial sequences (as shown in FIG. 8). Hence,

$\begin{matrix} {{{DIS}\left( {k,X_{m},Y_{n}} \right)} = {\min\limits_{\underset{1 \leq j < n}{1 \leq i < m}}\begin{Bmatrix} {{{{DIS}\left( {k,X_{m - 1},Y_{n - 1}} \right)} + {{dis}\left( {k,x_{m},y_{n}} \right)}},} \\ {{{{DIS}\left( {k,X_{m - 1},Y_{n}} \right)} + {{dis}\left( {k,x_{m},{null}} \right)}},} \\ {{{{DIS}\left( {k,X_{m},Y_{n - 1}} \right)} + {{dis}\left( {k,{null},y_{n}} \right)}},} \\ {{{{DIS}\left( {k,X_{m - 1},Y_{j - 1}} \right)} + {{dis}\left( {k,x_{m},{y_{j}\mspace{14mu} \ldots \mspace{14mu} y_{n}}} \right)}},} \\ {{{{DIS}\left( {k,X_{i - 1},Y_{n - 1}} \right)} + {{dis}\left( {k,{x_{i}\mspace{14mu} \ldots \mspace{14mu} x_{m}},y_{n}} \right)}},} \\ {{{DIS}\left( {k,X_{i - 1},Y_{j - 1}} \right)} + {{dis}\left( {k,{x_{i}\mspace{14mu} \ldots \mspace{14mu} x_{m}},{y_{j}\mspace{14mu} \ldots \mspace{14mu} y_{n}}} \right)}} \end{Bmatrix}}} \\ {= {\min\limits_{{({i,j})} \in {\lbrack{{({0,0})},{({m,n})}})}}\left\{ {{{DIS}\left( {k,X_{i},Y_{j}} \right)} + {{dis}\left( {k,X_{m\backslash i},Y_{n\backslash j}} \right)}} \right\}}} \end{matrix}$

Therefore, the DIS(K,S,T) in Eq. (4) can be obtained from Eq. (7) by letting k=K,X_(m)=S,Y_(n)=T. The Eqn. (7) indicates a recursive process because, in order to obtain DIS(k,X_(m),Y_(n)), the values of all the shorter sequence distances DIS(k,X_(i),Y_(j)) (0≦i<m, 0≦j<n) need to be known in advance. To avoid unnecessary duplicate computation, it can be started from the ‘s’ to smallest case DIS(k,X₀,Y₀), then proceed by adding one element in one of both sequence till getting the final D/S(K,S,T).

By integrating (3) to (7), the overall recursive formula is given below:

$\begin{matrix} {{{DIS}\left( {k,X_{m},Y_{n}} \right)} = \left\{ {\begin{matrix} {{\min\limits_{{({i,j})} \in {\lbrack{{({0,0})},{({m,n})}})}}\; \begin{Bmatrix} {{{DIS}\left( {k,X_{i},Y_{j}} \right)} +} \\ {{{dis}_{r}\left( {{r\left( X_{m\backslash i} \right)},{r\left( Y_{n\backslash j} \right)}} \right)} \oplus} \\ {{DIS}\left( {{k - 1},{{sub}\left( X_{m\backslash i} \right)},{{sub}\left( Y_{n\backslash j} \right)}} \right)} \end{Bmatrix}},} & {1 < k \leq \text{?}} \\ {{\min\limits_{{({i,j})} \in {\lbrack{{({0,0})},{({m,n})}})}}\left\{ {{{DIS}\left( {k,X_{i},Y_{j}} \right)} + {{dis}_{r}\left( {{r\left( X_{m\backslash i} \right)},{r\left( Y_{n\backslash j} \right)}} \right)}} \right\}},} & {k = \text{?}} \end{matrix}\text{?}\text{indicates text missing or illegible when filed}} \right.} & (8) \end{matrix}$

The interaction ⊕ in (8) is still kept in the formula since in different specific situations it indicates different forms.

Thus, based on the recursive functions Eq. (8), dynamic programming can be applied to achieve the overall optimal alignment of two structures. The algorithm goes from the bottom level to the top level to get each level of distances DIS(k,.,.) until the K^(th) level.

The total number of feasible alignments between two K-level hierarchical structures rises up to 0 (2^(K(|S′|+|T′|))max(|S′|,|T′|)^(K min(|S′|,|T′|))), which would be unreachable by current computation capability when the number of elements in the sequence rises up to thousand level (S′ and T′ are the sets of all 1^(st) level elements in the K-level hierarchical structures S and T).

Because the disclosed embodiments are based on a dynamic programming technique, which can greatly speed up the computing efficiency by decreasing the time complexity down to Σ_(i=1) ^(|S′|)Σ_(j=1) ^(|T′|)((i+1)(j+1)−1)=O((|S′∥T′|)²) on one single level. Thus, the total complexity considering the dynamic programming on different levels would be O((|S′∥T′|)²K).

Returning to FIG. 4, after finding an alignment between the first content sequence and the second content sequence (406), the processor 302 may displaying the alignment or matching results to the user (408). For example, processor 302 may mark the first content sequence and the second content sequence and display the marked first content sequence and second content sequence such that the user can understand the results in a side-by-side comparison format. The processor 302 may generate a report recording the matching or alignment results.

Further, the processor 302 may also integrate the matched or aligned first content sequence and second content sequence to produce an integrated sequence for further processing or for being displayed to the user, such as a complete list of similar items from two or more different websites. For example, as shown in FIG. 1A and FIG. 1B, the processor 302 may align contents on the Amazon webpage and contents on the Yahoo! Shopping webpage, and display common contents in a separate webpage such that the user can find common items on both Amazon and Yahoo! Shopping. Other methods and processing may also be used.

Thus, according to disclosed embodiments, two sequential structures can be aligned, each medium with a hierarchical structure, and an optimal alignment between two media with the minimal distance of the corresponding structures can be determined. The distance of alignment may be the summation of costs of all aligning pairs in the alignment. In addition, by representing a structure with a root element sequence and sub-tree structures, the cost of a pair of two structures is obtained from distance of their root node sequences and the optimal alignment distance of their sub-tree structures. Thus, based on the observation that the recursive and additive characteristics of structure construction reflect the inherent properties of media, dynamic programming can be applied to solving an optimization problem that minimizes the distance between media, consequently, the hierarchical alignment can be achieved.

Although the above examples use sub-titles, other type of medium, such as video data may also similarly used. For video contents, video scenes, shots, frames, and blocks may be used as elements or features to align video contents, i.e., in a “scene-shot-frame-block” structure.

By using the disclosed methods and systems, a variety of content matching applications can be implemented. For example, plagiarists often modify the structure of the original paper to escape inspection. They may combine several paragraphs or sentences into one, separate one sentence into short pieces, or paraphrase them. Universities and publishers wish to find out how to detect plagiarism more accurately to protect copyrights.

Further, foreign language learners use foreign movie titles (with subtitles) to practice their language capabilities. The subtitles can be obtained from two different sources, either downloaded from Internet that may not match exactly with the version of title in play, or obtained from OCR (optical character recognition) tools that may contain errors. How to make use of both sources to achieve an accurate subtitle is interesting for these learners.

With disclosed matching/alignment algorithm based methods and systems for handling hierarchical information pieces, book store managers can build taxonomy for their new bookstores supporting both Amazon and Yahoo! Shopping's taxonomies; universities and publishers can detect plagiarism by aligning suspicious documents and source documents [13]; and foreign language learners can get correct subtitles of TV shows by aligning the OCR subtitles with the one found online.

Those skilled in the art should understand that all or part of the steps in the above method may be executed by relevant hardware instructed by a program, and the program may be stored in a computer-readable storage medium such as a read only memory, a magnetic disk, a Compact Disc (CD), and so on.

The embodiments disclosed herein are exemplary only and not limiting the scope of this disclosure. Without departing from the spirit and scope of this invention, other modifications, equivalents, or improvements to the disclosed embodiments are obvious to those skilled in the art and are intended to be encompassed within the scope of the present disclosure. 

What is claimed is:
 1. A method for content alignment, comprising: obtaining a first content sequence and a second content sequence different from the first content sequence; representing each of the first content sequence and the second content sequence in a hierarchical structure containing an ordered root element sequence and a sub-tree structure, wherein the ordered root element sequence includes a plurality of root elements and each root element is associated with a sub-tree of elements; determining a desired alignment between the first content sequence and the second content sequence using dynamic programming; and outputting results of the desired alignment between the first content sequence and the second content sequence.
 2. The method according to claim 1, wherein: the hierarchical structure is divided into a plurality of hierarchical levels, and each hierarchical level includes one or more sequences of elements.
 3. The method according to claim 1, wherein: the first content sequence and the second content sequence are movie subtitles; and the hierarchical structure includes three levels of a “paragraph-sentence-word” structure.
 4. The method according to claim 1, wherein: the first content sequence and the second content sequence are video contents; and the hierarchical structure includes four levels of a “scene-shot-frame-block” structure.
 5. The method according to claim 2, wherein determining a desired alignment between the first content sequence and the second content sequence further includes: determining an align pair for each of selected elements from the first content sequence and the second content sequence, wherein the align pair is either a pair of an element of the first content sequence and an element of the second content sequence or a pair of an element of the first content sequence or the second content sequence and null; determining a distance of each align pair as a dissimilarity between the elements in the align pair; and determining a total distance of all align pairs of the selected elements as a total distance of an alignment between the selected elements of the first content sequence and the second content sequence.
 6. The method according to claim 5, further including: determining a distance of root elements of the first content sequence and the second content sequence; determining a distance of sub-tree structure elements of the first content sequence and the second content sequence; determining a total distance of the first content sequence and the second content sequence, as a total distance of an alignment between the first content sequence and the second content sequence, based on the distance of root elements and the distance of sub-tree structure elements.
 7. The method according to claim 6, wherein: the root elements are represented by vector of features; the values of the vector is Boolean or normalized real numbers in [0, 1]; and a Euclidean distance is used as a measurement for a distance between vectors.
 8. The method according to claim 6, further including: recursively determining the total distances between the first content sequence and the second content sequence to find a minimum distance between the first content sequence and the second content sequence; and determining an alignment with the minimum distance between the first content sequence and the second content sequence as the desired alignment between the first content sequence and the second content sequence.
 9. The method according to claim 1, wherein outputting results of the desired alignment further includes: integrating aligned first content sequence and second content sequence to produce an integrated content sequence based on the desired alignment; and displaying the integrated content sequence to a user.
 10. A content alignment system, comprising: a memory module; an output interface; and a processor coupled to the memory module and the output interface and configured to: obtain a first content sequence and a second content sequence different from the first content sequence; represent each of the first content sequence and the second content sequence in a hierarchical structure containing an ordered root element sequence and a sub-tree structure, wherein the ordered root element sequence includes a plurality of root elements and each root element is associated with a sub-tree of elements; determine a desired alignment between the first content sequence and the second content sequence using dynamic programming; and output results of the desired alignment between the first content sequence and the second content sequence through the output interface.
 11. The content alignment system according to claim 10, wherein: the hierarchical structure is divided into a plurality of hierarchical levels, and each hierarchical level includes one or more sequences of elements.
 12. The content alignment system according to claim 10, wherein: the first content sequence and the second content sequence are movie subtitles; and the hierarchical structure includes three levels of a “paragraph-sentence-word” structure.
 13. The content alignment system according to claim 10, wherein: the first content sequence and the second content sequence are video contents; and the hierarchical structure includes four levels of a “scene-shot-frame-block” structure.
 14. The content alignment system according to claim 11, wherein, to determine a desired alignment between the first content sequence and the second content sequence, the processor is further configured to: determine an align pair for each of selected elements from the first content sequence and the second content sequence, wherein the align pair is either a pair of an element of the first content sequence and an element of the second content sequence or a pair of an element of the first content sequence or the second content sequence and null; determine a distance of each align pair as a dissimilarity between the elements in the align pair; and determine a total distance of all align pairs of the selected elements as a total distance of an alignment between the selected elements of the first content sequence and the second content sequence.
 15. The content alignment system according to claim 14, wherein the processor is further configured to: determine a distance of root elements of the first content sequence and the second content sequence; determining a distance of sub-tree structure elements of the first content sequence and the second content sequence; determine a total distance of the first content sequence and the second content sequence, as a total distance of an alignment between the first content sequence and the second content sequence, based on the distance of root elements and the distance of sub-tree structure elements.
 16. The content alignment system according to claim 15, wherein: the root elements are represented by vector of features; the values of the vector is Boolean or normalized real numbers in [0, 1]; and a Euclidean distance is used as a measurement for a distance between vectors.
 17. The content alignment system according to claim 15, wherein the processor is further configured to: recursively determine the total distances between the first content sequence and the second content sequence to find a minimum distance between the first content sequence and the second content sequence; and determine an alignment with the minimum distance between the first content sequence and the second content sequence as the desired alignment between the first content sequence and the second content sequence.
 18. The content alignment system according to claim 10, wherein, to output results of the desired alignment, the processor is further configured to: integrate aligned first content sequence and second content sequence to produce an integrated content sequence based on the desired alignment; and display the integrated content sequence to a user. 